<?php
	 $user = $controller->getCurrentUser();    
	//on verifie les permissions
	if ($user->isAllowedTo(GRADE_MOD_BOOK))
	{
		if (!$cotation = $request->getParam('cotation'))
		{
			$controller->addError('Veuillez saisir une cotation');
			$controller->forward('changeBook');
		}
		else	
		{	
			$nbBook = book::count(null,$cotation);
			
			if ($nbBook == 0)
			{
				$controller->addError('Aucun album ne correspond &agrave; cette cote !');
				$controller->forward('changeBook');
			}
			else if ($nbBook == 1)
			{
				$controller->setVar('cotation',$cotation);
				$controller->forward('changeBookStep3');
			}
			else
			{
				$controller->setVar('cotation',$cotation);
				$controller->forward('changeBookSelectAlbum');	
			}
		}
	}
	else
		$controller->render('errorRights');
  
?>
